package com.fafa.File;

import org.junit.Test;

import java.io.File;

public class FileInformation {
    public static void main(String[] args) {

    }

    @Test
    public void info()
    {
        File file = new File("E:\\news1.txt");
        System.out.println("文件名：" + file.getName());
        System.out.println("绝对路径" + file.getAbsolutePath());
        System.out.println("文件父级目录" + file.getParent());
        System.out.println("文件大小：" + file.length());
        System.out.println("是否存在" + file.exists());
        System.out.println("是否是文件" + file.isFile());
        System.out.println("是否是目录" + file.isDirectory());
    }
}


